package com.winxuan.channel.support.view.excel;

import java.util.Locale;

import org.springframework.web.servlet.View;
import org.springframework.web.servlet.view.AbstractCachingViewResolver;



/**
 * Excel 视图解析
 * 
 * @author HideHai
 * @version 1.0,2011-6-19
 */
public class ExcelViewResolver extends AbstractCachingViewResolver{

	private String prefix = "";
	private String suffix = "";

	@Override
	protected View loadView(String viewName, Locale locale) throws Exception {
		ExcelView excelView = new ExcelView();
		String excelTemplatePath =  prefix + viewName + suffix;
		excelTemplatePath = getServletContext().getRealPath(excelTemplatePath);
		excelView.setExcelTemplatePath(excelTemplatePath);
		return excelView;
	}

	@Override
	protected Object getCacheKey(String viewName, Locale locale) {
		return viewName;
	}

	public String getPrefix() {
		return prefix;
	}

	public void setPrefix(String prefix) {
		this.prefix = prefix;
	}

	public String getSuffix() {
		return suffix;
	}

	public void setSuffix(String suffix) {
		this.suffix = suffix;
	}
}
